<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>setInterval当作for</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
    </style>
</head>
<body>
    
    <script type="text/javascript">
            var count = 0;
        for(var i = 0; i < 10; i ++){
            // console.log(i);

            for(var j = 0; j < 10; j ++){
                // console.log(j);
                // count ++;
            }
        }    
        
        var i = 0,
            j = 0;

        var timer = setInterval(function (){
            if(j == 10){
                // clearInterval(timer);
                i ++;
                j = 0;
            }
            if(i == 10){
                clearInterval(timer);
                console.log("count", count);
                return;
            }
            count ++;
            console.log(j);

            j ++;
        }, 100)

        
    </script>
</body>
</html>